package com.lishe.lishe.lishe.module.excitation.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.github.chrisbanes.photoview.PhotoView;
import com.lishe.base.viewpager.MZViewHolder;
import com.lishe.lishe.Imageloader.ImageLoaderUtils;
import com.lishe.lishe.R;

/**
 * 标    题：
 * 功能描述：
 * 作    者：zouxx
 * 创建时间：2018/8/9
 */

public class PictureViewerAdapter implements MZViewHolder<String> {
    private PhotoView mImageView;
    private View.OnClickListener listener;

    public PictureViewerAdapter(){
    }

    public PictureViewerAdapter(View.OnClickListener listener){
        this.listener = listener;
    }

    @Override
    public View createView(Context context) {
        // 返回页面布局文件
        View view = LayoutInflater.from(context).inflate(R.layout.item_single_picture, null);
        mImageView = view.findViewById(R.id.image_item);
        mImageView.setOnClickListener(listener);
        return view;
    }

    @Override
    public void onBind(Context context, int position, String url) {
        // 数据绑定
        if (url.contains("-small")){
            url = url.replace("-small","");
        }
        ImageLoaderUtils.displayImage(context, url,mImageView,R.drawable.defalut_img);
    }
}
